php return function result to variable

32

You can create function in php this way:

<?php

$name = array("ghp", "hamid", "amin", "Linux");
function find()
{
    $find = 0;
    if(in_array('hamid', $name))
    {
      $find = 1;
      return $find;
    }
    else 
    {
      return $find;
    }
}


//###################
$answare = find();
echo $answare;
?>

Comments

Submit
0 Comments